<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="{__STATIC_PATH__}index/cart1/css/address.css" type="text/css">
    <link rel="stylesheet" href="{__STATIC_PATH__}index/cart1/css/base.css" type="text/css">
    <link rel="stylesheet" href="{__STATIC_PATH__}index/cart1/css/home.css" type="text/css">
    <link rel="stylesheet" href="{__STATIC_PATH__}index/cart1/css/global.css" type="text/css">
    <script type="text/javascript" src="/static/layui/layui.js"></script>
    <script type="text/javascript" src="/static/index/js/jquery.min.js"></script>
    <script type="text/javascript" src="/static/layui/layui.js"></script>
    <script type="text/javascript" src="{__STATIC_PATH__}index/js/jquery.min.js"></script>
    <script type="text/javascript" src="{__STATIC_PATH__}index/cart1/js/address.js"></script>
</head>
<body>
<div class="main w1210 bc mt10">
    <div class="crumb w1210">
        <h2><strong>我的XX </strong><span>> 我的订单</span></h2>
    </div>

    <!-- 左侧导航菜单 start -->
    <div class="menu fl">
        <h3>我的XX</h3>
        <div class="menu_wrap">
            <dl>
                <dt>订单中心 <b></b></dt>
                <dd><b>.</b><a href="">我的订单</a></dd>
                <dd><b>.</b><a href="">我的关注</a></dd>
                <dd><b>.</b><a href="">浏览历史</a></dd>
                <dd><b>.</b><a href="">我的团购</a></dd>
            </dl>

            <dl>
                <dt>账户中心 <b></b></dt>
                <dd class="cur"><b>.</b><a href="">账户信息</a></dd>
                <dd><b>.</b><a href="">账户余额</a></dd>
                <dd><b>.</b><a href="">消费记录</a></dd>
                <dd><b>.</b><a href="">我的积分</a></dd>
                <dd><b>.</b><a href="">收货地址</a></dd>
            </dl>

            <dl>
                <dt>订单中心 <b></b></dt>
                <dd><b>.</b><a href="">返修/退换货</a></dd>
                <dd><b>.</b><a href="">取消订单记录</a></dd>
                <dd><b>.</b><a href="">我的投诉</a></dd>
            </dl>
        </div>
    </div>
    <!-- 左侧导航菜单 end -->

    <!-- 右侧内容区域 start -->
    <div class="content fl ml10">

        <div class="address_bd mt10">
            <h4>新增收货地址</h4>
            <form action="" id="address_form" method="post">
                <input type="hidden" name="id" value="{$address.id}">
                <ul>
                    <li>
                        <label for=""><span>*</span>收 货 人：</label>
                        <input type="text" name="name" value="{$address.name}" class="txt" />
                    </li>
                    <li>
                        <label for=""><span>*</span>别 名：</label>
                        <input type="text" name="alias" value="{$address.alias}" class="txt" />
                    </li>
                    <li>
                        <label for=""><span>*</span>所在地区：</label>
                        <select name="province" id="province" onchange="doProvAndCityRelation();">
                            <option id="choosePro" value="{$address.province}">{$address.province}</option>
                        </select>
                        <select name="city" id="citys" onchange="doCityAndCountyRelation();">
                            <option id='chooseCity' value='{$address.city}'>{$address.city}</option>
                        </select>
                        <select name="county" id="county">
                            <option id='chooseCounty' value='{$address.county}'>{$address.county}</option>
                        </select>
                    </li>
                    <li>
                        <label for=""><span>*</span>详细地址：</label>
                        <input type="text" name="address" value="{$address.address}" class="txt address"  />
                    </li>
                    <li>
                        <label for=""><span>*</span>手机号码：</label>
                        <input type="text" name="tel" value="{$address.tel}" class="txt" />
                    </li>
                    <li>
                        <label for="">&nbsp;</label>
                        <input type="checkbox" name="is_default" class="check" value="1" {if condition="$address.is_default == 1"} checked {else /} "" {/if} />设为默认地址
                    </li>
                    <li>
                        <label for="">&nbsp;</label>
                        <input type="button" onclick="add()" class="btn" value="保存" />
                    </li>
                </ul>
            </form>
        </div>

    </div>
    <!-- 右侧内容区域 end -->
</div>
<script type="text/javascript">
    layui.use(['layer'],function(){
        $ = layui.jquery;
        layer = layui.layer;
    });
    function add(){
        $.post('/index/address/edit',$("#address_form").serialize(),function(data){
            if(data.code>0){
                layer.alert(data.msg,{icon:2});
            }else{
                layer.msg(data.msg);
                setTimeout(function(){window.location.href = '/index/address/add'},1000);
            }
        },'json');
    }
</script>
</body>
</html>